﻿using TripleClasses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace UnitTests
{
   
    [TestClass()]
    public class TripleTest
    {
        [TestMethod()]
        public void TripleConstructorTest()
        {
            int a = 0; // TODO: Initialize to an appropriate value
            int b = -1; // TODO: Initialize to an appropriate value
            int c = 24234; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c);
            Assert.IsTrue(target.A == a && target.B == b && target.C == c);
        }

        [TestMethod()]
        public void CloneTest()
        {
            int a = 1; // TODO: Initialize to an appropriate value
            int b = 0; // TODO: Initialize to an appropriate value
            int c = -2323; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            object expected = new Triple(a, b, c);
            object actual;
            actual = target.Clone();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CompareToTest()
        {
            int a = -2; // TODO: Initialize to an appropriate value
            int b = 0; // TODO: Initialize to an appropriate value
            int c = 4; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            Triple other = new Triple(-4, 0, 3);
            int expected = 1; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CompareToTest2()
        {
            int a = -2; // TODO: Initialize to an appropriate value
            int b = 0; // TODO: Initialize to an appropriate value
            int c = 4; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            Triple other = new Triple(-4, 0, 7);
            int expected = -1; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CompareToTest3()
        {
            int a = -2; // TODO: Initialize to an appropriate value
            int b = 0; // TODO: Initialize to an appropriate value
            int c = 4; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            Triple other = new Triple(-4, 6, 0);
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }

        [ExpectedException(typeof(ArgumentNullException),("Cannot compare to null object"))]
        [TestMethod()]
        public void CompareToNullTest()
        {
            int a = -2; // TODO: Initialize to an appropriate value
            int b = 0; // TODO: Initialize to an appropriate value
            int c = 4; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            Triple other = null;
            int expected = 1; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.CompareTo(other);
            Assert.AreEqual(expected, actual);
        }
        
        [TestMethod()]
        public void ToStringTest()
        {
            int a = 132; // TODO: Initialize to an appropriate value
            int b = -123; // TODO: Initialize to an appropriate value
            int c = -12; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            string expected = @"(132, -123, -12)";
            string actual;
            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }

        [ExpectedException(typeof(ArgumentOutOfRangeException), "Sum exceeds int32 max value")]
        [TestMethod()]
        public void op_Addition_OutOfRange_Test()
        {
            Triple triple1 = new Triple(int.MaxValue, 0, -4);
            Triple triple2 = new Triple(4, -2, 14);
            Triple expected = new Triple(5, -2, 10);
            Triple actual;
            actual = (triple1 + triple2);
            Assert.AreEqual(expected, actual);
        }

        [ExpectedException(typeof(ArgumentOutOfRangeException), "Sum exceeds int32 max value")]
        [TestMethod()]
        public void op_Increment_OutOfRange_Test()
        {
            Triple triple = new Triple(int.MaxValue, 0, -4);
            Triple expected = new Triple(2, 1, -3);
            Triple actual;
            actual = ++(triple);
            Assert.AreEqual(expected, actual);
        }

        [ExpectedException(typeof(ArgumentOutOfRangeException), "Sum deceeds int32 max value")]
        [TestMethod()]
        public void op_Subtraction_OutOfRange_Test()
        {
            Triple triple1 = new Triple(int.MinValue, 0, -4);
            Triple triple2 = new Triple(4, -2, -14);
            Triple expected = new Triple(23, 2, 10);
            Triple actual;
            actual = (triple1 - triple2);
            Assert.AreEqual(expected, actual);
        }


        [TestMethod()]
        public void op_AdditionTest()
        {
            Triple triple1 = new Triple(1, 0, -4);
            Triple triple2 = new Triple(4, -2, 14);
            Triple expected = new Triple(5, -2, 10);
            Triple actual;
            actual = (triple1 + triple2);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void op_IncrementTest()
        {
            Triple triple = new Triple(1, 0, -4);
            Triple expected = new Triple(2, 1, -3);
            Triple actual;
            actual = ++(triple);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void op_SubtractionTest()
        {
            Triple triple1 = new Triple(1, 0, -4);
            Triple triple2 = new Triple(4, -2, -14);
            Triple expected = new Triple(-3, 2, 10);
            Triple actual;
            actual = (triple1 - triple2);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ATest()
        {
            int a = -12; // TODO: Initialize to an appropriate value
            int b = 0; // TODO: Initialize to an appropriate value
            int c = 0; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            int expected = -12; // TODO: Initialize to an appropriate value
            int actual;
            target.A = expected;
            actual = target.A;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void BTest()
        {
            int a = 0; // TODO: Initialize to an appropriate value
            int b = 4; // TODO: Initialize to an appropriate value
            int c = 0; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            int expected = 4; // TODO: Initialize to an appropriate value
            int actual;
            target.B = expected;
            actual = target.B;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void CTest()
        {
            int a = 0; // TODO: Initialize to an appropriate value
            int b = 0; // TODO: Initialize to an appropriate value
            int c = 5; // TODO: Initialize to an appropriate value
            Triple target = new Triple(a, b, c); // TODO: Initialize to an appropriate value
            int expected = 5; // TODO: Initialize to an appropriate value
            int actual;
            target.C = expected;
            actual = target.C;
            Assert.AreEqual(expected, actual);
        }
    }
}
